<?php
    require('fun/function.php');
    $con = getconnect('china');
    $email=$_POST['email'];
    $emailCode=$_POST['email_code'];
    $password1=$_POST['password1'];
    $password2=$_POST['password2'];
    $verifyCode=$_POST['verify_code'];
    $path = "/^[a-zA-Z0-9]+([-_.][a-zA-Z0-9]+)*@([a-zA-Z0-9]+[-.])+([a-z]{2,5})$/";//邮箱
    if($email=="")
	{
		skip("邮箱不能为空!","findcode.html");
		die();
	}
    if((preg_match($path,$email)==0))
    {
        skip("邮箱格式不正确","findcode.html");
    }
	elseif($password1==""){
		skip("密码不能为空","findcode.html");
	}
	elseif($password2==""){
		skip("请确认密码","findcode.html");
		die();
	}
	elseif(strcmp(strtolower($yzm),strtolower($_SESSION['code']))!=0)
	{
		skip("图片验证码错误!","findcode.html");
		die();
	}
	elseif($_SESSION['emailcode']!=$emailcode){
		skip("邮箱验证码错误!","findcode.html");
		die();
	}		
	else 
	{	
        $password1=md5($password1);
		$sql4 = "update users set password ='$password1' where email=".$email." and state=1 ;";
		mysqli_query($con,$sql4);
		skip("修改成功，赶快登录吧！","login.html");
    }
?>